#include <iostream>
#include <fstream>
#include <vector>
#include <ctime>
using namespace std;
double bubble(vector<int>& f) {
    clock_t start = sclock();
    for (int x = 0; x < f.size() - 2; x++) {
        for (int y = x + 1; y < f.size() - 1; y++) {
            if (f[y] > f[y + 1]) {
                swap(f[y], f[y + 1]);
            }
        }
    }
    clock_t end = clock();
    return 1000.0 * (end - start) / CLOCKS_PER_SEC;
}

int main() {
    ifstream s1("m1_sorted.txt");
    ifstream s2("m2_reverse.txt");
    ifstream s3("m3_shuffle.txt");

    vector<int> m1;
    vector<int> m2;
    vector<int> m3;

    int num;
    while (s1 >> num) {
        m1.push_back(num);
    }
    while (s2 >> num) {
        m2.push_back(num);
    }
    while (s3 >> num) {
        m3.push_back(num);
    }

    s1.close();
    s2.close();
    s3.close();

    cout << "m1_sorted: " << static_cast<int>(bubble(m1)) << " milliseconds" << endl;
    cout << "m2_reverse: " << static_cast<int>(bubble(m2)) << " milliseconds" << endl;
    cout << "m3_shuffle: " << static_cast<int>(bubble(m3)) << " milliseconds" << endl;

    return 0;
}

